Implement n3668 - std::exchange git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185863 91177308-0d34-0410-b5e6-96231b3b80d8 
diff --git a/include/utility b/include/utility index ba65649..a2cafbf 100644 --- a/include/utility +++ b/include/utility 
@@ -138,6 +138,8 @@  template<class... T>  using index_sequence_for = make_index_sequence<sizeof...(T)>;   +template<class T, class U=T>  + T exchange(T& obj, U&& new_value);  } // std    */ @@ -685,6 +687,17 @@    #endif // _LIBCPP_STD_VER > 11   +#if _LIBCPP_STD_VER > 11 +template<class _T1, class _T2 = _T1> +_LIBCPP_INLINE_VISIBILITY inline +_T1 exchange(_T1& __obj, _T2 && __new_value) +{ +	_T1 __old_value = _VSTD::move(__obj); +	__obj = _VSTD::forward<_T2>(__new_value); +	return __old_value; +} +#endif // _LIBCPP_STD_VER > 11 +  _LIBCPP_END_NAMESPACE_STD    #endif // _LIBCPP_UTILITY